export const schema = {
    type: "page",
    title: "编辑商品",
    initApi: "/api/goods/${id}",
    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "查看",
                    to: "/score_mall/goods/view/${id}"
                },
                {
                    label: "编辑",
                    to: "/score_mall/goods/edit/${id}"
                },
            ]
        },
        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                api: "put:/api/goods/${id}",
                submitText: "",
                name: "createform",
                type: "form",
                title: "",
                className: "m-t-md",
                panelClassName: "no-border no-shadow m-b-none",
                mode: "horizontal",
                actions: [
                    {
                        type: "button",
                        actionType: "submit",
                        label: "提交",
                        icon: "fa fa-check pull-left",
                        level: "primary",
                        redirect: "/score_mall/goods/edit/${id}",
                    },
                ],
                fieldSet: [
                    {
                        title: "基本信息",
                        controls: [
                            {
                                type: "select",
                                name: "org_id",
                                label: "所属机构",
                                source: "/api/org/sug?_=${_}",
                                required: true,
                                inline: true,
                                visibleOn: "!data.query.org_id && !acl.can('skip:select-org')"
                            },
                            {
                                type: "select",
                                name: "team_id",
                                label: "发布团队",
                                inline: true,
                                required: true,
                                visibleOn: "!acl.can('skip:select-team')",
                                autoComplete: "/api/team/sug?auth_create_goods=1&org_id=${org_id}&_=$_",
                                cache: false,
                                clearable: true,
                            },

                            {
                                label: "商品名称",
                                name: "g_name",
                                type: "text",
                                // minLength: 5,
                                maxLength: 32,
                                required: true
                            },

                            {
                                label: "支持方",
                                name: "sponsor",
                                type: "text",
                                maxLength: 32,
                            },

                            {
                                type: "image",
                                label: "商品小图",
                                maxSize: 10 * 1024 * 1024,
                                // accept: "image/png,image/jpeg",
                                desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 10M，建议尺寸比例：（260 x 180）；<br>' +
                                    '商品小图会用于列表页展示',
                                // desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 1M',
                                name: "thumbnail",
                                required: true,

                            },
                            {
                                type: "image",
                                label: "商品大图",
                                maxSize: 10 * 1024 * 1024,
                                // accept: "image/png,image/jpeg",
                                desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 10M，建议尺寸比例：（750 x 420）；<br>' +
                                    '商品大图会用于商品详情页展示',
                                // desc: '请选择 jpg 或者 png 图片，单个文件请不要超过 1M',
                                name: "g_img",
                                required: true,
                            },

                            {
                                label: "商品详情",
                                name: "content",
                                type: "rich-text",
                                required: true,
                            },

                            {
                                label: "兑换成功文案",
                                name: "access",
                                type: "textarea",
                                maxLength: 32,
                            },
                        ]
                    },

                    {
                        title: "兑换规则",
                        controls: [
                            {
                                type: "text",
                                label: "市面价值",
                                name: "price",
                                validations: 'isNumeric,minimum:0',
                                required: true
                            },
                            {
                                name: 'points',
                                label: '消耗积分',
                                validations: 'minimum:0,isInt',
                                placeholder: '兑换该商品所需要消耗的积分',
                                required: true,
                                width: 500,
                                type: 'number'
                            },
                            {
                                name: 'g_num',
                                label: '库存',
                                validations: 'minimum:0,isInt',
                                placeholder: '不填则不限制',
                                type: 'number'
                            },
                            {
                                name: 'u_num',
                                placeholder: '不填则不限制，填写则为一个用户最多兑换个数',
                                label: '用户兑换限制',
                                validations: 'minimum:0,isInt',
                                type: 'number'
                            },
                            [
                                {
                                    label: "线下兑换日期",
                                    type: "date",
                                    name: "start_time",
                                    required: true,
                                    maxDate: '${end_time}'
                                },

                                {
                                    label: "到",
                                    labelClassName: "w-xxs",
                                    type: "date",
                                    name: "end_time",
                                    required: true,
                                    minDate: '${start_time}',
                                    // maxDate: '${auto_time}'
                                }
                            ],
                            {
                                label: "自动下架时间",
                                type: "date",
                                name: "auto_time",
                                required: true,
                                width: 200,
                                minDate: '+2hours',
                                maxDate: '${end_time}',
                            },
                            {
                                type: "text",
                                label: "额外兑换限制",
                                placeholder: "填写限制兑换的人群或要求等，以英文逗号分隔，建议14字以内",
                                name: "condition",
                                // required: true
                            },

                            // {
                            //     label: '领取方式',
                            //     name: '',
                            //     type: "radios",
                            //     inline: true,
                            //     options: [
                            //         {
                            //             label: "快递",
                            //             value: 1
                            //         },
                            //         {
                            //             label: "类型2",
                            //             value: 2
                            //         }
                            //     ],
                            // },

                            {
                                type: "checkbox",
                                name: "examine",
                                option: "是否开启审核？",
                                value: "0",
                                label: "",
                                trueValue: "1",
                                falseValue: "0"
                            },

                        ]
                    },
                ]
            }
        }]
};
